package jiyici;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class Server2ClientSyncData {

    private ArrayList<Server2ClientSyncItem> items = new ArrayList<Server2ClientSyncItem>();

    public void addSyncItem(Server2ClientSyncItem item) {
        items.add(item);
    }

    public JSONObject toJson() throws JSONException {
        JSONObject json = new JSONObject();
        JSONArray array = new JSONArray();
        int size = items.size();
        for (int i = 0; i < size; i++) {
            array.put(items.get(i).toJson());
        }
        json.put("syncData", array);
        return json;
    }
}
